Skip to content

Handle QLineEdit focus object correctly with QCompleter in Qt6 #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

wyu71
Copy link
Contributor

@wyu71 wyu71 commented Jun 13, 2025

In Qt6, when using QLineEdit with QCompleter during Chinese input:

  • qGuiApp->focusObject() and realFocusObject are both QLineEdit
  • This is logically correct as the focus is indeed on QLineEdit
  • However, it caused filterEvent to return false and trigger unwanted keypress events
  • Remove redundant check to ensure proper input method handling

This fixes input method behavior when using QLineEdit with QCompleter in Qt6, especially for Chinese input scenarios.

In Qt6, when using QLineEdit with QCompleter during Chinese input:
- qGuiApp->focusObject() and realFocusObject are both QLineEdit
- This is logically correct as the focus is indeed on QLineEdit
- However, it caused filterEvent to return false and trigger unwanted keypress events
- Remove redundant check to ensure proper input method handling

This fixes input method behavior when using QLineEdit with QCompleter
in Qt6, especially for Chinese input scenarios.
@wengxt
Copy link
Member

wengxt commented Jun 16, 2025

This is actually due to qt fix the original https://bugreports.qt.io/browse/QTBUG-108522

Now focusObject is correct, however, focusWindow won't adapt to relevant changes. I think it somehow makes sense since focusWindow has some other meanings.

But we still want to have the window associated with focusObject. I think the change here actually make sense, when focusObject is a QWidget, always use the QWindow of the widget.

@wengxt wengxt merged commit 1a59fba into fcitx:master Jun 16, 2025
4 checks passed
wyu71 added a commit to wyu71/fcitx5-qt-community that referenced this pull request Jun 18, 2025
In Qt6, when using QLineEdit with QCompleter during Chinese input:
- qGuiApp->focusObject() and realFocusObject are both QLineEdit
- This is logically correct as the focus is indeed on QLineEdit
- However, it caused filterEvent to return false and trigger unwanted keypress events
- Remove redundant check to ensure proper input method handling

Log: Handle QLineEdit focus object correctly with QCompleter in Qt6
Upstream: fcitx/fcitx5-qt#71
Zeno-sole pushed a commit to deepin-community/fcitx5-qt that referenced this pull request Jun 18, 2025
In Qt6, when using QLineEdit with QCompleter during Chinese input:
- qGuiApp->focusObject() and realFocusObject are both QLineEdit
- This is logically correct as the focus is indeed on QLineEdit
- However, it caused filterEvent to return false and trigger unwanted keypress events
- Remove redundant check to ensure proper input method handling

Log: Handle QLineEdit focus object correctly with QCompleter in Qt6
Upstream: fcitx/fcitx5-qt#71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants